home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_weap_imp4.cog < prev    next >
Text File  |  1999-11-15  |  4KB  |  199 lines

  1. # Jones 3D Cog Script
  2. #
  3. # weap_IMP4.cog
  4. #
  5. # [RT]
  6. #
  7. # Controls Infernal Machine Part #4, the Power Part.
  8. #
  9. # (C) 1998 LucasArts Entertainment Company LLC. All Rights Reserved
  10. #
  11. # ===================================================================
  12.  
  13. symbols
  14.  
  15. message        startup
  16. message        fire
  17. message        activated
  18. message        deactivated
  19. message        selected
  20. message        deselected
  21. message        callback
  22. message        timer
  23. message        changed
  24.  
  25. model        impOn=imp4_energ_on.3do        local    # Autoloaded
  26. model        impOff=imp4_energ.3do        local    # Autoloaded
  27.  
  28. sound        pull=gen_grenade_pull.wav    local    # Autoloaded
  29. sound        put=gen_grenade_put.wav        local    # Autoloaded
  30. sound        pow=imp4_activate.wav        local    # Autoloaded
  31. sound        on=imp4_powerup.wav            local    # Autoloaded
  32. sound        off=imp4_powerdown.wav        local    # Autoloaded
  33. sound        loop=imp4_on_loop.wav        local    # Autoloaded
  34.  
  35. template    projectile=+imp4            local    # Autoloaded
  36. template    redSparks=+imp4_sparks1        local    # Autoloaded
  37. template    blueSparks=+imp4_sparks2    local    # Autoloaded
  38. template    tplGlow=+imp4_glow            local    # Autoloaded
  39.  
  40. thing        player                        local
  41. thing        bullet                        local
  42. thing        glow                        local
  43.  
  44. int            weaponNum=17                local
  45. int            handMesh                    local
  46. int            handNode                    local
  47. int            callNum                        local
  48. int            curSound                    local
  49. int            index                        local
  50.  
  51. int            bDisabled=0                    local
  52.  
  53. vector        firePos                        local
  54. vector        dustPos                        local
  55.  
  56. end
  57.  
  58. # ===================================================================
  59.  
  60. code
  61.  
  62. startup:
  63.  
  64.     player = GetLocalPlayerThing();
  65.     handMesh = GetMeshByName(player, "inrhand");
  66.     handNode = GetNodeByName(player, "inrhand");
  67.  
  68.     return;
  69.  
  70. # -------------------------------------------------------------------
  71.  
  72. fire:
  73.  
  74.     if (bDisabled)
  75.     {
  76.         bDisabled = 0;
  77.         return;
  78.     }
  79.  
  80.     SetThingMesh(player, handMesh, impOn, 0);
  81.  
  82.     firePos = GetThingJointPos(player, handNode);
  83.     
  84.     bullet = FireProjectile(player, projectile, pow, -1, firePos, '0 0 0', 1.0, 0x0, 0.0, 0.0);
  85.     if (bullet != -1)
  86.     {
  87.         CreateThing(redSparks, bullet);
  88.         CreateThing(blueSparks, bullet);
  89.     }
  90.  
  91.     dustPos = GetThingJointPos(player, handNode);
  92.     dustPos = VectorAdd(dustPos, '0 0 0.03'); 
  93.     for(index = 0; index < 5; index = index + 1)
  94.     {
  95.         MakeFairyDust(player, dustPos);
  96.     }
  97.  
  98.     IMPStartFiring(17);
  99.  
  100.     SetFireWait(player, 1.5);
  101.     SetTimer(0.2);
  102.  
  103.     return;
  104.  
  105. # -------------------------------------------------------------------
  106.  
  107. activated:
  108.  
  109.     ActivateWeapon(player, 0.01);
  110.     return;
  111.  
  112. # -------------------------------------------------------------------
  113.  
  114. deactivated:
  115.  
  116.     DeactivateWeapon(player);
  117.     return;
  118.  
  119. # -------------------------------------------------------------------
  120.  
  121. selected:
  122.  
  123.     SetAimWait(player, 0.0);
  124.     SetMountWait(player, 0.7);
  125.  
  126.     SetArmedMode(player, 5);
  127.     SetCurWeapon(player, weaponNum);
  128.     SetThingFireOffset(player, '0.0 0.0 0.03'); 
  129.  
  130.     CaptureThing(player);
  131.     PlayMode(player, 66, 0);
  132.  
  133.     return;
  134.  
  135. # -------------------------------------------------------------------
  136.  
  137. deselected:
  138.  
  139.     SetMountWait(player, 1.0);
  140.     StopMode(player, 66, 0);
  141.  
  142.     CaptureThing(player);
  143.     PlayMode(player, 67, 0);
  144.  
  145.     SetArmedMode(player, 0);
  146.  
  147.     StopSound(curSound, 0.0);
  148.     PlaySoundThing(off, player, 1, -1, -1, 0x880);
  149.  
  150.     return;
  151.  
  152. # -------------------------------------------------------------------
  153.  
  154. callback:
  155.  
  156.     callNum = GetParam(1);
  157.     ReleaseThing(player);
  158.  
  159.     if (callNum == 28)
  160.     {
  161.         # Model swaps & FX
  162.         SetWeaponModel(player, weaponNum);
  163.         glow = AttachThingToThingMesh(player, tplGlow, handMesh);
  164.         
  165.         # Sounds
  166.         PlaySoundThing(pull, player, 1, -1, -1, 0x880);
  167.         PlaySoundThing(on, player, 1, -1, -1, 0x880);
  168.         Sleep(0.25);
  169.         curSound = PlaySoundThing(loop, player, 1, -1, -1, 0x881);
  170.     }
  171.     else if (callNum == 29)
  172.     {
  173.         # Cleanup...
  174.         ResetWeaponModel(player);
  175.         DetachThingMesh(glow);
  176.  
  177.         PlaySoundThing(put, player, 1, -1, -1, 0x880);
  178.     }
  179.  
  180.     return;
  181.  
  182. # -------------------------------------------------------------------
  183.  
  184. timer:
  185.  
  186.     SetThingMesh(player, handMesh, impOff, 0);
  187.     IMPEndFiring(17);
  188.     return;
  189.  
  190. # -------------------------------------------------------------------
  191.  
  192. changed:
  193.  
  194.     # This message is called when an IMP is activated on an IMP stand
  195.     bDisabled = 1;
  196.     return;
  197.  
  198. end
  199.